package Acwing.基础算法;

import java.util.Scanner;

/**
 * @Title: theNumberOfOnes
 * @Author 贾金博
 * @Package Acwing.基础算法
 * @Date 2025/4/10 上午11:02
 * @description: 1的个数
 */
public class theNumberOfOnes {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 1; i <= n; i ++ ) {
            int x = sc.nextInt();
            System.out.print(number(x) + " ");
        }
    }

    private static int number(int x) {
        int count = 0;
        while(x != 0) {
            if((x & 1) == 1 ) { // 表示的是 x的  最后  一位是 1
                count ++ ;
            }
            x >>= 1;
        }
        return count;
    }
}
